package com.lhn.spring5;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 构造函数注入.
 *
 * @author lhn
 * @date 2021/12/24 14:02
 * @since 1.0.0
 **/
@Component
public class Order {

    /**
     * 订单
     */
    private String oname;

    /** 地址 */
    private String address;

    @Autowired
    private Book book;

    public Order(String oname, String address,Book book) {
        this.oname = oname;
        this.book = book;
        this.address = address;
    }

    public Order() {
    }

    public Order(String oname) {
        this.oname = oname;
    }

    public void setBook(Book book) {
        this.book = book;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("Order{");
        sb.append("oname='").append(oname).append('\'');
        sb.append(", address='").append(address).append('\'');
        sb.append(", book=").append(book);
        sb.append('}');
        return sb.toString();
    }
}